#!/bin/sh
# Source tutorial run functions
#. $WM_PROJECT_DIR/bin/tools/RunFunctions

#rm -rf log*
#rm -rf 0
#cp -r 0.org 0

decomposePar -force

sed -i 's/\(startFrom \).*;/\1    startTime;/g' system/controlDict
sed -i 's/\(startTime \).*;/\1    0;/g' system/controlDict
sed -i 's/\(endTime \).*;/\1    4500;/g' system/controlDict
sed -i 's/\(stopAt \).*;/\1    endTime;/g' system/controlDict
sed -i 's/\(writeInterval \).*;/\1    100;/g' system/controlDict
sed -i 's/\(deltaT \).*;/\1   1;/g' system/controlDict
sed -i 's/\(turbulence \).*;/\1    on;/g' constant/RASProperties
sed -i 's/\(RASModel \).*;/\1    realizableKE;/g' constant/RASProperties
sed -i 's/\(application \).*;/\1    rhoSimpleFoam;/g' system/controlDict

sed -i 's/\(p \).*;/\1    0.3;/g' system/fvSolution #0.6 - try 0.3?
sed -i 's/\(rho \).*;/\1    0.05;/g' system/fvSolution
sed -i 's/\(U \).*;/\1    0.6;/g' system/fvSolution #0.7 - try 0.6?
sed -i 's/\(k \).*;/\1    0.9;/g' system/fvSolution #0.9
sed -i 's/\(epsilon\).*;/\1    0.9;/g' system/fvSolution #0.9
sed -i 's/\(h \).*;/\1    0.6;/g' system/fvSolution #0.7

mpirun -np 4 rhoSimpleFoam -parallel > log.init & pyFoamPlotWatcher.py log.init

